import fetch from "@/utils/fetch"

//根据连接名获取数据连接列表
export function getlinklist(data){
    
    return fetch({
        url:'dataConnect/getConnectInfo',
        method:'post',
        headers: {'content-type': 'application/json;charset=UTF-8'},
        data:JSON.stringify(data)
    })
}
//保存mysql
export function saveMysql(data){
    console.log(data);
    return fetch({
        url:'dataConnect/createConn',
        method:'post',
        headers: {'content-type': 'application/json;charset=UTF-8'},
        data:JSON.stringify(data)
    })
}
//获取mysql数据
export function getMysql(data){
    console.log(data);
    return fetch({
        url:'dataConnect/getByFirstDb/'+data,
        method:'get',
        headers: {'content-type': 'application/json;charset=UTF-8'},
    })
}
//获取mysql单个数据库数据
export function getMysqltable(connId,name){
    console.log(connId,name);
    return fetch({
        url:'dataConnect/getTables/'+connId+'/'+name,
        method:'get',
        headers: {'content-type': 'application/json;charset=UTF-8'},
    })
}
//获取mysql单个表数据
export function getMysqlsutable(connId,dbName,tableName){
    console.log(connId,dbName,tableName);
    return fetch({
        url:'dataConnect/getDataByTableName/'+connId+'/'+dbName+'/'+tableName,
        method:'get',
        headers: {'content-type': 'application/json;charset=UTF-8'},
    })
}
//mysql抽取设置
export function getMysqlsetting(connId,dbName,tableName){
    console.log(connId,dbName,tableName);
    return fetch({
        url:'dataConnect/getFiledByExtractTable/'+connId+'/'+dbName+'/'+tableName,
        method:'get',
        headers: {'content-type': 'application/json;charset=UTF-8'},
    })
}
//提交抽取设置
export function subMysqlsetting(data){
    console.log(data);
    return fetch({
        url:'dataConnect/createTable',
        method:'post',
        headers: {'content-type': 'application/json;charset=UTF-8'},
        data:JSON.stringify(data)
    })
}
//获取相关信息
export function getrelData(data){
    console.log(data);
    return fetch({
        url:'dataConnect/getrelatedInfo',
        method:'post',
        headers: {'content-type': 'application/json;charset=UTF-8'},
        data:JSON.stringify(data)
    })
}
//保存excel
export function saveExcel(data){
    console.log(data);
    return fetch({
        url:'users/login',
        method:'post',
        headers: {'content-type': 'application/json;charset=UTF-8'},
        data:JSON.stringify(data)
   
    })
}
//保存orcle
export function saveOrcle(data){
    console.log(data);
    return fetch({
        url:'users/login',
        method:'post',
        headers: {'content-type': 'application/json;charset=UTF-8'},
        data:JSON.stringify(data)
    })
}
//保存csv
export function saveCsv(data){
    console.log(data);
    return fetch({
        url:'users/login',
        method:'post',
        headers: {'content-type': 'application/json;charset=UTF-8'},
        data:JSON.stringify(data)
    })
}
//保存tXT
export function saveTxt(data){
    console.log(data);
    return fetch({
        url:'users/login',
        method:'post',
        headers: {'content-type': 'application/json;charset=UTF-8'},
        data:JSON.stringify(data)
    })
}
//根据数据类型，数据库名称获取数据库信息
export function getDbdata(data){
    console.log(data);
    return fetch({
        url:'users/login',
        method:'post',
        headers: {'content-type': 'application/json;charset=UTF-8'},
        data:JSON.stringify(data)
    })
}